package com.doule.farmerassistant.task;

import android.app.Service;

import com.doule.farmerassistant.MyService;
import com.doule.farmerassistant.R;

/**
 * Task detail.
 * 
 * @author riguang
 * 
 */
public class TaskDetail {
    /**
     * status enumeration.
     * @author Happy
     *
     */
    public enum TaskStatus {
        /**
         * stop.
         */
        Stop,
        /**
         * running.
         */
        Running
    }

    /**
     * Task type.
     */
    private String mType;

    /**
     * Task id.
     */
    private String mId;
    
    /**
     * Task name.
     */
    private String mName;
    
    /**
     * Task use batch type.
     */
    private String mPerbatch;
    
    /**
     * Task duration.
     */
    private String mDuration;
    
    /**
     * Task was select or not.
     */
    private boolean isChecked;

    /**
     * Task status.
     */
    private TaskStatus mStatus;
    
    /**
     * TaskTetail constructor.
     * @param type
     * task type
     * @param id
     * task id
     * @param name
     * task name
     * @param perbatch
     * task use batch type
     * @param duration
     * task duration
     * @param status
     * status
     */
    public TaskDetail(final String type, final String id, final String name,
            final String perbatch, final String duration, final TaskStatus status) {
        mType = type;
        mId = id;
        mName = name;
        mPerbatch = perbatch;
        mDuration = duration;
        mStatus = status;
    }

    /**
     * Get task type.
     * @return mType
     */
    public String getType() {
        return mType;
    }

    /**
     * Get task id.
     * @return mId
     */
    public String getId() {
        return mId;
    }

    /**
     * Get task name.
     * @return mName
     */
    public String getName() {
        return mName;
    }

    /**
     * Get task's batch type.
     * @return mBatchType
     */
    public String getPerbatch() {
        return mPerbatch;
    }

    /**
     * Get task's duration.
     * @return mDuration
     */
    public String getDuration() {
        return mDuration;
    }

    /**
     * Check task if check or not.
     * @return isChecked
     */
    public boolean isChecked() {
        // TODO Auto-generated method stub
        return isChecked;
    }

    /**
     * If task was select set it's isChecked.
     * @param b task was select flag
     */
    public void setChecked(boolean b) {
        // TODO Auto-generated method stub
        isChecked = b;
    }
    
    /**
     * get status.
     * @return status
     */
    public TaskStatus getStatus() {
        return mStatus;
    }
    /**
     * set status.
     * @param s status
     */
    public void setStatus(TaskStatus s) {
        mStatus = s;
    }
    /**
     * get status string.
     * @return status string
     */
    public String getStatusString() {
        Service s = MyService.getInstance();
        switch(mStatus) {
        case Stop:
            return s.getResources().getString(R.string.TaskStatus_Stop);
        case Running:
            return s.getResources().getString(R.string.TaskStatus_Running);
        default:
            return s.getResources().getString(R.string.TaskStatus_Unknown);
        }
    }
    
    
}
